home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 2207 / 2207.xpi / chrome / cooliris.jar / content / cooliris / coolirisOverlay.js < prev    next >
Text File  |  2010-01-28  |  49KB  |  1,399 lines

  1. var cpvw_Delays={OPEN_DELAY_TIME:500,CLOSE_DELAY_TIME:1000,PREFETCH_DELAY_TIME:5000,DISPLAY_DELAY_TIME:800,ICON_DELAY_TIME:400,PREVIEW_ON_ICON_DELAY:500};
  2. var cpvw_docHandler,cpvw_imageDocHandler;
  3. var cpvw_objOverlay={welcomePage:"http://www.coolpreviews.com/client/links/welcome.php",updatePage:"http://www.coolpreviews.com/client/links/upgrade.php",uninstallPage:"http://www.coolpreviews.com/client/links/uninstall.php",clean:function(){
  4. cpvw_uninstallManager.unregister();
  5. },addEventHandlers:function(){
  6. cpvw_Prefs.initPreferences();
  7. cpvw_previewHandler.previewOpenMode=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewOpenMode);
  8. cpvw_docHandler=new cpvw_clsPreview();
  9. cpvw_docHandler.setup();
  10. var _1=document.getElementById("content");
  11. cpvw_uninstallManager.register();
  12. _1.addEventListener("TabSelect",function(_2){
  13. setTimeout(function(){
  14. cpvw_previewHandler.hidePreview(true,"tabSelect");
  15. cpvw_objOverlay.handleSearchPage();
  16. cpvw_objOverlay.changeLinks();
  17. cpvw_stackManager.displayStack(true);
  18. },1);
  19. },false);
  20. if(cpvw_urlListener){
  21. gBrowser.addProgressListener(cpvw_urlListener,Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
  22. }
  23. var _3=document.getElementById("content");
  24. _3.addEventListener("DOMContentLoaded",function(_4){
  25. cpvw_previewHandler.previewOpenMode=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewOpenMode);
  26. cpvw_objOverlay.handleSearchPage();
  27. var _5=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewEnable);
  28. if(_5=="no"){
  29. cpvw_get("preview-status-image").src="chrome://cooliris/skin/new/globaloff.png";
  30. cpvw_get("preview-status").setAttribute("status","globaloff");
  31. return;
  32. }
  33. if("@mozilla.org/login-manager;1" in Components.classes){
  34. }
  35. var _6;
  36. var _7=cpvw_objOverlay.getContentDocument();
  37. var _8=new XPCNativeWrapper(_4,"originalTarget").originalTarget;
  38. var _9=Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
  39. var _a=Components.classes["@mozilla.org/xpcom/version-comparator;1"].getService(Components.interfaces.nsIVersionComparator);
  40. var _b=cpvw_getDocuments(cpvw_objOverlay.getContentWindow());
  41. if(_7==_8){
  42. for(var i=0;i<_b.length;i++){
  43. cpvw_objOverlay.changeLinks(_b[i]);
  44. }
  45. }
  46. },true);
  47. if(document.getElementById("contentAreaContextMenu")){
  48. document.getElementById("contentAreaContextMenu").addEventListener("popupshowing",function(_d){
  49. cpvw_objOverlay.previewContextMenuPopup();
  50. },false);
  51. }
  52. var _e=cpvw_objStats.getAddonVersion(false);
  53. if(cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewIsNew).toString()=="0"){
  54. cpvw_objStats.setInitPreferences();
  55. cpvw_prefHandler.setPref(cpvw_Prefs.prefUserType,"new");
  56. cpvw_objStats.sendInstallEvent("install");
  57. setTimeout(function(){
  58. var _f=cpvw_objOverlay.welcomePage+"?guid="+cpvw_prefHandler.getPref(cpvw_Prefs.prefGUID)+"&version="+cpvw_objStats.getAddonVersion(true);
  59. openUILinkIn(_f,"tab");
  60. },1000);
  61. }else{
  62. if(cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewIsNew).toString()!=_e.toString()){
  63. var _10=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewIsNew).toString();
  64. cpvw_objStats.setInitPreferences();
  65. if(_10=="3.0"){
  66. cpvw_prefHandler.setPref(cpvw_Prefs.prefInstallTS,Math.round((new Date()).getTime()/1000));
  67. }
  68. cpvw_prefHandler.setPref(cpvw_Prefs.prefLastUpdateTS,Math.round((new Date()).getTime()/1000));
  69. cpvw_prefHandler.setPref(cpvw_Prefs.prefUserType,"upgrade");
  70. cpvw_objStats.sendInstallEvent("update");
  71. var _11=Components.classes["@mozilla.org/xpcom/version-comparator;1"].getService(Components.interfaces.nsIVersionComparator);
  72. if(_11.compare(cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewIsNew).toString(),_e.toString())<0){
  73. setTimeout(function(){
  74. var _12=cpvw_objOverlay.updatePage+"?guid="+cpvw_prefHandler.getPref(cpvw_Prefs.prefGUID)+"&version="+cpvw_objStats.getAddonVersion(true);
  75. openUILinkIn(_12,"tab");
  76. },1000);
  77. }
  78. var _13="2.9.1104";
  79. if(_11.compare(cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewIsNew).toString(),_13)<0){
  80. cpvw_prefHandler.setPref(cpvw_Prefs.prefTheme,"default");
  81. if(cpvw_contextSitesTreeView.arrCMenuItems==null){
  82. cpvw_contextSitesTreeView.loadContextSites(false,true);
  83. }
  84. if(!cpvw_contextSitesTreeView.arrCMenuItems["googlesearch"]){
  85. cpvw_contextSitesTreeView.loadContextSites(true,true);
  86. }
  87. cpvw_contextSitesTreeView.arrCMenuItems["googlesearch"].url="http://www.google.com/cse?cx=partner-pub-8018945467905048:5qnmya-8kmb&ie=ISO-8859-1&q=$";
  88. cpvw_contextSitesTreeView.arrCMenuItems["cooliris"]={label:"Cooliris",url:"http://www.cooliris.com/tab/#p=Channels&s=$",image:"http://www.cooliris.com/favicon.ico"};
  89. cpvw_contextSitesTreeView.arrCMenuItems["bingsearch"]={label:"Bing",url:"http://www.bing.com/search?q=$&qs=n",image:"http://www.bing.com/favicon.ico"};
  90. cpvw_contextSitesTreeView.arrCMenuItems["twitter"]={label:"Twitter",url:"http://twitter.com/search?q=$",image:"http://www.twitter.com/favicon.ico"};
  91. cpvw_contextSitesTreeView.arrCMenuItems["amazonsearch"]={label:"Amazon",url:"http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&field-keywords=$&x=0&y=0&tag=cooliris-20",image:"http://www.amazon.com/favicon.ico"};
  92. cpvw_contextSitesTreeViewSelected.arrSites.push("cooliris");
  93. cpvw_contextSitesTreeViewSelected.arrSites.push("bingsearch");
  94. cpvw_contextSitesTreeViewSelected.arrSites.push("twitter");
  95. var _14=cpvw_prefHandler.getPref(cpvw_Prefs.prefCMenuItems);
  96. if(_14=="googlesearch,googleimages,youtube,wiki,tfd"){
  97. cpvw_prefHandler.setPref(cpvw_Prefs.prefCMenuItems,"cooliris,googlesearch,twitter,youtube,wiki,dictionary,googleimages,amazonsearch,bingsearch");
  98. }else{
  99. var _15=_14.split(",");
  100. if(_15.indexOf("cooliris")==-1){
  101. _15=["cooliris"].concat(_15);
  102. }
  103. if(_15.indexOf("twitter")==-1){
  104. _15=_15.concat("twitter");
  105. }
  106. if(_15.indexOf("bingsearch")==-1){
  107. _15=_15.concat("bingsearch");
  108. }
  109. cpvw_prefHandler.setPref(cpvw_Prefs.prefCMenuItems,_15.join(","));
  110. }
  111. cpvw_contextSitesTreeView.saveContextSites();
  112. }
  113. }
  114. }
  115. cpvw_prefHandler.setPref(cpvw_Prefs.prefPreviewIsNew,_e);
  116. setInterval(function(){
  117. cpvw_objStats.checkIfInactiveUser();
  118. },60000);
  119. setInterval(function(){
  120. if(cpvw_docHandler&&cpvw_docHandler.isShowingPreview){
  121. return;
  122. }
  123. cpvw_objStats.checkBufferAndSend();
  124. },1800000);
  125. cpvw_objOverlay.checkAdPreferences();
  126. },checkAdPreferences:function(){
  127. var _16=cpvw_prefHandler.getPref(cpvw_Prefs.prefAdPingInterval);
  128. if(_16==0||_16<300000){
  129. _16=3600000;
  130. }
  131. var _17=parseInt(cpvw_prefHandler.getPref(cpvw_Prefs.prefAdUpdateTime),10);
  132. if(isNaN(_17)){
  133. cpvw_prefHandler.setPref(cpvw_Prefs.prefAdUpdateTime,Math.round((new Date()).getTime()/1000));
  134. }
  135. var _18=(new Date()).getTime()-_17;
  136. if(_18>_16){
  137. cpvw_objOverlay.getAdPreferences();
  138. setTimeout(function(){
  139. cpvw_objOverlay.checkAdPreferences();
  140. },_16+Math.floor(Math.random()*1000));
  141. }else{
  142. var _19=cpvw_prefHandler.getPref(cpvw_Prefs.prefAdPrefJson);
  143. cpvw_objOverlay.setAdPreferences(_19);
  144. setTimeout(function(){
  145. cpvw_objOverlay.checkAdPreferences();
  146. },_18+Math.floor(Math.random()*1000));
  147. }
  148. },isAdblockEnabled:function(){
  149. try{
  150. var _1a="{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}";
  151. var em=Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
  152. var _1c=em.getInstallLocation(_1a);
  153. return _1c;
  154. }
  155. catch(e){
  156. }
  157. return false;
  158. },setAdPreferences:function(_1d){
  159. var _1e=parseInt(cpvw_prefHandler.getPref(cpvw_Prefs.prefLastUpdateTS),10)*1000;
  160. var _1f=cpvw_prefHandler.getPref(cpvw_Prefs.prefUserType);
  161. var _20=cpvw_prefHandler.getPref(cpvw_Prefs.prefAdId);
  162. var _21,_22;
  163. _21=cpvw_previewHandler.getPreviewWindow();
  164. try{
  165. if(cpvw_jsUtils.isFF2()){
  166. _22=cpvw_JSON.fromString(_1d);
  167. }else{
  168. var _23=Components.classes["@mozilla.org/dom/json;1"].createInstance(Components.interfaces.nsIJSON);
  169. _22=_23.decode(_1d);
  170. }
  171. if(!_22.hasOwnProperty("pingInterval")){
  172. throw "not a valid object";
  173. }
  174. cpvw_prefHandler.setPref(cpvw_Prefs.prefAdPrefJson,_1d);
  175. }
  176. catch(ex){
  177. cpvw_adManager.leftAdFrameSize=0;
  178. cpvw_adManager.rightAdFrameSize=0;
  179. cpvw_adManager.topAdFrameSize=0;
  180. cpvw_adManager.bottomAdFrameSize=0;
  181. return;
  182. }
  183. cpvw_prefHandler.setPref(cpvw_Prefs.prefAdPingInterval,_22.pingInterval);
  184. for(var i=0;i<_22.adTypes.length;i++){
  185. var _25=_22.adTypes[i];
  186. if(_25.type=="PreviewFrames"){
  187. var _26=_25.details;
  188. cpvw_adManager.adLaunchFrequency=_25.adLaunchFrequency||0;
  189. cpvw_adManager.adDisplayCap=_25.adDisplayCap||3;
  190. cpvw_adManager.adDisplayCapCookie=_25.adDisplayCapCookie||"adDisplayCount";
  191. if(_25.deleteCookie=="yes"){
  192. var ios=Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
  193. var _28=ios.newURI(cpvw_adManager.domain,null,null);
  194. var _29=Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
  195. _29.setCookieString(_28,null,cpvw_adManager.adDisplayCapCookie+"=;",null);
  196. }
  197. if(_1e>=_25.startDate&&_1e<=_25.endDate){
  198. if(_1f==_25.installType||_25.installType=="all"){
  199. if(_26.left.enabled===true){
  200. cpvw_adManager.leftAdFrameSize=_26.left.size+2;
  201. }
  202. if(_26.right.enabled===true){
  203. cpvw_adManager.rightAdFrameSize=_26.right.size+2;
  204. }
  205. if(_26.top.enabled===true){
  206. cpvw_adManager.topAdFrameSize=_26.top.size+4;
  207. }
  208. if(_26.bottom.enabled===true){
  209. cpvw_adManager.bottomAdFrameSize=_26.bottom.size+5;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. },getAdPreferences:function(){
  216. var _2a=parseInt(cpvw_prefHandler.getPref(cpvw_Prefs.prefLastUpdateTS),10)*1000;
  217. var _2b=cpvw_prefHandler.getPref(cpvw_Prefs.prefUserType);
  218. var _2c=cpvw_prefHandler.getPref(cpvw_Prefs.prefAdId);
  219. var _2d=cpvw_adManager.adPrefsUrl+"?adId="+_2c+"&installDate="+_2a+"&userType="+_2b+"&version="+cpvw_objStats.getAddonVersion(false);
  220. var _2e=new cpvw_httpClient(this);
  221. var _2f=this;
  222. _2e.doRequest("GET",_2d,"","",false,null,function(_30){
  223. if(_30.hasErrors){
  224. return;
  225. }
  226. cpvw_prefHandler.setPref(cpvw_Prefs.prefAdUpdateTime,Math.round((new Date()).getTime()/1000));
  227. _2f.setAdPreferences(_30.responseText);
  228. });
  229. },removeEventHandlers:function(){
  230. cpvw_objOverlay.clean();
  231. gBrowser.removeProgressListener(cpvw_urlListener);
  232. },createBrowser:function(){
  233. var _31=cpvw_previewHandler.getPreviewFrame();
  234. var _32;
  235. try{
  236. _32=_31.webNavigation;
  237. if(!_32){
  238. throw "no XBL binding for browser";
  239. }
  240. }
  241. catch(e){
  242. alert("Error launching browser window:"+e);
  243. window.close();
  244. return;
  245. }
  246. _31.setAttribute("disablehistory",false);
  247. _32.sessionHistory=Components.classes["@mozilla.org/browser/shistory;1"].createInstance(Components.interfaces.nsISHistory);
  248. },removeLinks:function(){
  249. var _33=cpvw_objOverlay.getContentDocument();
  250. if(_33){
  251. _33.enablePreview=false;
  252. var _34=_33.getElementsByTagName("a");
  253. for(var i=0;i<_34.length;i++){
  254. _34[i].removeAttribute("set");
  255. }
  256. }
  257. },handleSearchPage:function(){
  258. return;
  259. var _36=cpvw_objOverlay.getContentDocument();
  260. if(_36.documentURI=="chrome://cooliris/content/coolirisSearch.xul"){
  261. cpvw_get("cooliris-search-box").hidden=false;
  262. }else{
  263. cpvw_get("cooliris-search-box").hidden=true;
  264. }
  265. },changeLinks:function(){
  266. var _37=cpvw_objOverlay.getContentDocument();
  267. var _38=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewEnable);
  268. if(_38=="no"){
  269. cpvw_get("preview-status-image").src="chrome://cooliris/skin/new/globaloff.png";
  270. cpvw_get("preview-status").setAttribute("status","globaloff");
  271. _37.enablePreview=false;
  272. return;
  273. }
  274. if(_37.fromCache){
  275. if(_37.enablePreview){
  276. cpvw_docHandler.parentDoc=_37;
  277. document.getElementById("preview-status-image").src="chrome://cooliris/skin/new/previews-on.png";
  278. cpvw_get("preview-status").setAttribute("status","previewsOnSite");
  279. return;
  280. }
  281. }
  282. var _37=cpvw_objOverlay.getContentDocument();
  283. cpvw_docHandler.parentDoc=_37;
  284. cpvw_docHandler.curIndex=0;
  285. var _39=cpvw_siteManager.isCustomSite(_37.location.href);
  286. cpvw_docHandler.parentDoc.enablePreview=false;
  287. if(_39[0]){
  288. _37.fromCache=true;
  289. document.getElementById("preview-status-image").src="chrome://cooliris/skin/new/previews-on.png";
  290. cpvw_get("preview-status").setAttribute("status","previewsOnSite");
  291. if(_37.isChanged==null){
  292. var _3a=_39[1];
  293. cpvw_previewHandler.customSite=_3a;
  294. if(_3a=="google_images"||_3a=="yahoo_images"){
  295. _37.isChanged="yes";
  296. delete cpvw_imageDocHandler;
  297. cpvw_imageDocHandler=new cpvw_clsPreviewImages(_37,_3a);
  298. cpvw_imageDocHandler.setup();
  299. cpvw_imageDocHandler.parWindow=cpvw_objOverlay.getContentWindow();
  300. cpvw_imageDocHandler.parentDoc.enablePreview=true;
  301. }else{
  302. _37.isChanged="yes";
  303. cpvw_docHandler.customSite=_3a;
  304. cpvw_docHandler.parWindow=cpvw_objOverlay.getContentWindow();
  305. cpvw_docHandler.parentDoc.enablePreview=true;
  306. cpvw_docHandler.parentDoc.arrHighlightText="";
  307. if(_3a=="google_search"){
  308. var _3b=_37.location.href;
  309. var _3c=null;
  310. var _3d=_3b.match(/[&|?]q=(.*?)&/);
  311. if(_3d!=null&&_3d.length>1){
  312. _3c=_3d[1].split("+");
  313. }
  314. cpvw_docHandler.parentDoc.arrHighlightText=_3c;
  315. var _3e=cpvw_docHandler.parentDoc.isPrefetchSet;
  316. if(_3e==null||_3e==false){
  317. var _3f=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewPrefetch);
  318. if(_3f=="yes"){
  319. cpvw_docHandler.parentDoc.isPrefetchSet=true;
  320. cpvw_docHandler.startPrefetch();
  321. }
  322. }
  323. }else{
  324. if(_3a=="yahoo_search"){
  325. var _3e=cpvw_docHandler.parentDoc.isPrefetchSet;
  326. if(_3e==null||_3e==false){
  327. var _3f=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewPrefetch);
  328. if(_3f=="yes"){
  329. cpvw_docHandler.parentDoc.isPrefetchSet=true;
  330. cpvw_docHandler.startPrefetch();
  331. }
  332. }
  333. }
  334. }
  335. if(_3a=="yahoo_search"){
  336. setTimeout(function(){
  337. cpvw_docHandler.convertLinks();
  338. },1500);
  339. }else{
  340. cpvw_docHandler.convertLinks();
  341. }
  342. }
  343. }else{
  344. cpvw_docHandler.parentDoc.enablePreview=true;
  345. }
  346. }else{
  347. cpvw_docHandler.parentDoc.enablePreview=false;
  348. document.getElementById("preview-status-image").src="chrome://cooliris/skin/new/previews-off.png";
  349. cpvw_get("preview-status").setAttribute("status","previewsOffSite");
  350. }
  351. },contextMenus:["thefreedictionary","GoogleImages","Wicktionary","GoogleSearch"],previewContextMenuPopup:function(){
  352. var _40=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewEnable);
  353. if(cpvw_objContextMenu.isShowingPreview){
  354. return;
  355. }
  356. var _41=document.commandDispatcher.focusedWindow;
  357. var _42=_41.getSelection.call(_41);
  358. cpvw_objContextMenu.parentDoc=document.commandDispatcher.focusedWindow.document;
  359. _42=cpvw_jsUtils.trimWhitespace(_42.toString());
  360. var _43=document.getElementById("coolirisSearch");
  361. if(_42==""||_40=="no"){
  362. _43.hidden=true;
  363. }else{
  364. _43.hidden=false;
  365. }
  366. cpvw_objContextMenu.selectStr=_42;
  367. },getContentDocument:function(){
  368. return getBrowser().mCurrentBrowser.contentDocument;
  369. },getContentWindow:function(){
  370. return getBrowser().mCurrentBrowser.contentWindow;
  371. }};
  372. var cpvw_previewHandler={pushpin:false,isSendToOpen:false,isContextMenu:false,dragActive:false,resizeActive:false,dimPreview:null,curMouseLocX:0,curMouseLocY:0,sendToBoxLink:"http://www.coolpreviews.com/client/scripts/sendto.php",registrationLink:"http://www.coolpreviews.com/client/scripts/registration.htm",loginLink:"http://www.coolpreviews.com/client/scripts/login.htm",statsLink:"http://previews.cooliris.com/qc/",fontSize:1,startTime:(new Date()).getTime(),numPages:0,stackCount:0,previewLaunchCount:0,handleEvent:function(evt){
  373. if(evt.type=="DOMContentLoaded"){
  374. var _45=this.getPreviewFrame();
  375. if(_45.contentDocument.URL=="chrome://cooliris/content/coolirisBlank.htm"){
  376. return;
  377. }
  378. cpvw_previewHandler.pageLoad(evt);
  379. if(cpvw_previewHandler.customSite=="youtube_video"){
  380. if(_45.contentDocument&&_45.contentDocument.getElementById("watch-this-vid")){
  381. _45.contentDocument.getElementById("watch-this-vid").scrollIntoView(true);
  382. _45.contentWindow.scrollBy(5,0);
  383. }
  384. }
  385. if(!cpvw_jsUtils.isFF2()){
  386. _45.contentDocument.addEventListener("mouseup",cpvw_subSearchBar,false);
  387. }
  388. cpvw_previewHandler.setNavigationArrows();
  389. }else{
  390. if(evt.type=="CoolPreviewsCoolirisDontShow"){
  391. var obj=cpvw_jsUtils.decodeJson(cpvw_prefHandler.getPref(cpvw_Prefs.jsonPrefCooliris));
  392. obj.showCoolirisPage=false;
  393. cpvw_prefHandler.setPrefJson(cpvw_Prefs.jsonPrefCooliris,obj);
  394. if(cpvw_previewHandler.customSite=="google_images"||cpvw_previewHandler.customSite=="yahoo_images"){
  395. cpvw_imageDocHandler.startPiclensLite();
  396. cpvw_previewHandler.hidePreview(true,"CoolirisLite");
  397. }
  398. }else{
  399. if(evt.type=="CoolPreviewsCoolirisContinue"){
  400. if(cpvw_previewHandler.customSite=="google_images"||cpvw_previewHandler.customSite=="yahoo_images"){
  401. cpvw_imageDocHandler.startPiclensLite();
  402. cpvw_previewHandler.hidePreview(true,"CoolirisLite");
  403. }
  404. }
  405. }
  406. }
  407. },handleKeyPress:function(evt){
  408. conDump("Key Press = "+evt.keyCode+", "+evt.charCode+", "+evt.ctrlKey+", "+evt.metaKey+", "+evt.shiftKey);
  409. if(evt.keyCode==27){
  410. cpvw_previewHandler.hidePreview(true);
  411. }else{
  412. if(evt.keyCode==112){
  413. cpvw_previewHandler.togglePushPin();
  414. evt.preventDefault();
  415. }else{
  416. if(evt.altKey&&evt.keyCode==40){
  417. cpvw_previewHandler.gotoNextLink();
  418. evt.preventDefault();
  419. }else{
  420. if((evt.metaKey||evt.ctrlKey)&&evt.shiftKey&&evt.charCode==43){
  421. cpvw_previewHandler.doZoom("increase");
  422. evt.preventDefault();
  423. }else{
  424. if((evt.metaKey||evt.ctrlKey)&&evt.shiftKey&&(evt.charCode==95||evt.charCode==45)){
  425. cpvw_previewHandler.doZoom("decrease");
  426. evt.preventDefault();
  427. }else{
  428. if((evt.metaKey||evt.ctrlKey)&&evt.shiftKey&&evt.charCode==40){
  429. cpvw_previewHandler.doZoom("reset");
  430. evt.preventDefault();
  431. }else{
  432. if((evt.metaKey||evt.ctrlKey)&&evt.shiftKey&&evt.charCode==42){
  433. cpvw_previewHandler.doZoom("autofit");
  434. evt.preventDefault();
  435. }else{
  436. if(((evt.metaKey||evt.ctrlKey)&&evt.keyCode==8)||(evt.altKey&&evt.keyCode==37)){
  437. cpvw_previewHandler.goBack(evt);
  438. evt.preventDefault();
  439. }else{
  440. if((evt.metaKey||evt.ctrlKey)&&evt.charCode==100){
  441. cpvw_previewHandler.addBookmark();
  442. evt.preventDefault();
  443. }else{
  444. if((evt.metaKey||evt.ctrlKey)&&evt.charCode==103){
  445. cpvw_previewHandler.highlight();
  446. evt.preventDefault();
  447. }
  448. }
  449. }
  450. }
  451. }
  452. }
  453. }
  454. }
  455. }
  456. }
  457. },showPreview:function(_48,_49,_4a,_4b){
  458. if(_48==null){
  459. return;
  460. }
  461. var _4c=document.getElementById("cooliris-preview-overlay");
  462. if(_4c.hidden==false&&!_4b){
  463. return;
  464. }
  465. cpvw_previewHandler.pushpin=cpvw_prefHandler.getPref(cpvw_Prefs.prefLock);
  466. var _4d=cpvw_previewHandler.getPreviewFrame();
  467. _4c.hidden=false;
  468. this.previewLaunchCount++;
  469. cpvw_previewHandler.dimPreview=_48;
  470. cpvw_previewHandler.setThemeToolbar();
  471. cpvw_previewHandler.getPreviewWindow().setAttribute("hasCooliris",cpvw_jsUtils.hasCooliris());
  472. cpvw_previewHandler.getPreviewWindow().setAttribute("slideshowTip",cpvw_jsUtils.hasCooliris()?"View Google image results in Cooliris":"View Google image results in slideshow");
  473. cpvw_previewHandler.startTime=(new Date()).getTime();
  474. _4d.style.display="block";
  475. if(_48.width!=0&&!_4a){
  476. cpvw_previewHandler.changeDimensions(_48.left,_48.top,_48.width,1);
  477. var _4e=new cooliris_wc_clsWebControl(_4c,new cooliris_wc_Point(_48.left,_48.top),new cooliris_wc_Point(_48.left,_48.top),"expand");
  478. _4e.setDim(new cooliris_wc_Dim(_48.width,20),new cooliris_wc_Dim(_48.width,_48.height));
  479. _4e.callback=cpvw_previewHandler.changeDimensions;
  480. _4e.maxTimes=5;
  481. setTimeout(function(){
  482. _4e.expand();
  483. },0);
  484. _4e.endCallback=function(){
  485. if(cpvw_jsUtils.isFF2()){
  486. cpvw_previewHandler.changeDimensions(_48.left,_48.top,_48.width,_48.height+1);
  487. }
  488. CoolirisFramePanel.showHelperFrame();
  489. };
  490. }else{
  491. _4d.style.display="block";
  492. cpvw_previewHandler.changeDimensions(_48.left,_48.top,_48.width,_48.height);
  493. }
  494. try{
  495. if(_4d.contentDocument&&_4d.contentDocument.URL!="chrome://cooliris/content/coolirisPreviewImages.htm"){
  496. _4d.addProgressListener(cpvw_previewUrlListener,Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
  497. }
  498. }
  499. catch(ex){
  500. }
  501. var _4f=cpvw_objOverlay.getContentDocument();
  502. var _50=_4f.URL;
  503. cpvw_objStats.sendLaunchEvents((new Date()).getTime(),_50);
  504. window.addEventListener("keypress",cpvw_previewHandler.handleKeyPress,false);
  505. cpvw_objOverlay.createBrowser();
  506. cpvw_previewHandler.updatePushpinIcon();
  507. },hidePreview:function(_51,_52){
  508. if((cpvw_previewHandler.pushpin||cpvw_previewHandler.sticky||cpvw_previewHandler.dragActive||cpvw_previewHandler.resizeActive)&&_51!=true){
  509. return false;
  510. }
  511. cpvw_previewHandler.removeDragResizeEventHandlers();
  512. var _53=cpvw_previewHandler.getPreviewFrame();
  513. _53.markupDocumentViewer.fullZoom=1;
  514. if((cpvw_docHandler&&cpvw_docHandler.isShowingPreview)||(cpvw_objContextMenu&&cpvw_objContextMenu.isShowingPreview)||(cpvw_imageDocHandler&&cpvw_imageDocHandler.isShowingPreview)){
  515. cpvw_objStats.sendPreviewsLifeTimeEvents(cpvw_previewHandler.numPages,cpvw_previewHandler.stackCount);
  516. cpvw_objStats.sendCloseEvents(cpvw_previewHandler.startTime,(new Date()).getTime());
  517. cpvw_previewHandler.numPages=0;
  518. cpvw_objStats.sendBufferData();
  519. }
  520. var _54=document.getElementById("cooliris-preview-overlay");
  521. cpvw_subSearchBar.hideSearchBar(true);
  522. setTimeout(function(){
  523. try{
  524. if(_53.contentDocument&&_53.contentDocument.URL!="chrome://cooliris/content/coolirisPreviewImages.htm"&&_52!="tabSelect"){
  525. _53.removeProgressListener(cpvw_previewUrlListener);
  526. }
  527. }
  528. catch(ex){
  529. }
  530. _54.hidePopup();
  531. },1);
  532. if(cpvw_docHandler){
  533. cpvw_docHandler.isShowingPreview=false;
  534. if(cpvw_docHandler.parentDoc!=null){
  535. cpvw_docHandler.parentDoc.removeEventListener("click",cpvw_previewHandler.hidePreview,true);
  536. }
  537. CoolirisFramePanel.closeSendToOptions();
  538. if(CoolirisFramePanel.isHelperFrameOpen){
  539. CoolirisFramePanel.closeHelperFrame(true);
  540. }
  541. }
  542. window.removeEventListener("keypress",cpvw_previewHandler.handleKeyPress,false);
  543. return true;
  544. },setThemeToolbar:function(){
  545. var _55=cpvw_prefHandler.getPref(cpvw_Prefs.prefTheme);
  546. cpvw_previewHandler.getPreviewWindow().setAttribute("skin",_55);
  547. cpvw_get("cooliris_stackIcon").setAttribute("class","cooliris-stackicon-"+_55);
  548. cpvw_get("cooliris_canvasHolder").setAttribute("class","cooliris-stackHolder-"+_55);
  549. },setNavigationArrows:function(){
  550. var _56=cpvw_previewHandler.getPreviewFrame();
  551. setTimeout(function(){
  552. cpvw_previewHandler.getPreviewWindow().setAttribute("goForward",_56.webNavigation.canGoForward);
  553. cpvw_previewHandler.getPreviewWindow().setAttribute("goBack",_56.webNavigation.canGoBack);
  554. },100);
  555. },getBrowserDocument:function(){
  556. var _57=cpvw_get("content");
  557. if(_57){
  558. return _57.selectedBrowser.contentDocument;
  559. }
  560. },getCurrentBrowser:function(){
  561. var _58=cpvw_get("content");
  562. if(_58){
  563. return _58.selectedBrowser;
  564. }
  565. },getPreviewFrame:function(){
  566. return document.getElementById("cooliris-preview-overlay").getPreviewFrame();
  567. },getPreviewWindow:function(){
  568. return document.getElementById("cooliris-preview-overlay");
  569. },mouseOver:function(evt){
  570. if(this.isContextMenu){
  571. cpvw_objContextMenu.clearTimer(cpvw_objContextMenu.hideTimer);
  572. }else{
  573. var _5a=evt.relatedTarget;
  574. var _5b=cpvw_previewHandler.getPreviewFrame();
  575. var _5c=cpvw_get("cooliris-preview-overlay");
  576. if(!(evt.screenX>=_5c.boxObject.screenX&&evt.screenX<(_5c.boxObject.screenX+_5c.boxObject.width)&&(evt.screenY)>=_5c.boxObject.screenY&&evt.screenY<=(_5c.boxObject.screenY+_5c.boxObject.height+1))){
  577. return;
  578. }
  579. if(cpvw_docHandler){
  580. if(cpvw_stackManager.tabStackCount>0){
  581. cpvw_stackManager.previewMouseOver=true;
  582. }
  583. cpvw_docHandler.clearTimer(cpvw_docHandler.hideTimer);
  584. }
  585. if(cpvw_imageDocHandler){
  586. cpvw_imageDocHandler.clearTimer(cpvw_imageDocHandler.hideTimer);
  587. }
  588. }
  589. },mouseOut:function(evt){
  590. if(document.getElementById("contentAreaContextMenu").state=="open"){
  591. return;
  592. }
  593. if(this.isContextMenu){
  594. cpvw_objContextMenu.initPreviewHide(evt);
  595. }else{
  596. var _5e=evt.relatedTarget;
  597. var _5f=cpvw_previewHandler.getPreviewFrame();
  598. var _60=cpvw_get("cooliris-preview-overlay");
  599. if(evt.screenX>_60.boxObject.screenX&&evt.screenX<(_60.boxObject.screenX+_60.boxObject.width)&&evt.screenY>_60.boxObject.screenY&&evt.screenY<=(_60.boxObject.screenY+_60.boxObject.height)){
  600. return;
  601. }
  602. if(cpvw_docHandler){
  603. cpvw_docHandler.clearHideTimer();
  604. cpvw_docHandler.initPreviewHide(evt);
  605. }
  606. if(cpvw_imageDocHandler){
  607. cpvw_imageDocHandler.initPreviewHide(evt);
  608. }
  609. }
  610. },previewFrameKeyPress:function(evt){
  611. },showImages:function(){
  612. var _62=cpvw_previewHandler.getPreviewFrame();
  613. var _63=[];
  614. _63.push(_62.contentDocument);
  615. _63.concat(cpvw_getDocuments(_62.contentWindow));
  616. setTimeout(function(){
  617. for(var k=0;k<_63.length;k++){
  618. var _65=_63[k].images;
  619. for(var i=0;i<_65.length;i++){
  620. _65[i].setAttribute("src",_65[i].src);
  621. }
  622. var _67=_63[k].getElementsByTagName("body");
  623. if(_67.length==0){
  624. return;
  625. }
  626. var _68=_67[0].ownerDocument.createTreeWalker(_67[0],NodeFilter.SHOW_ELEMENT,null,false);
  627. var _69=Components.classes["@mozilla.org/inspector/dom-utils;1"].getService(Components.interfaces.inIDOMUtils);
  628. var _6a;
  629. while((_6a=_68.nextNode())!=null){
  630. var _6b=_69.getCSSStyleRules(_6a);
  631. if(_6a.style.backgroundImage!=null){
  632. _6a.style.backgroundImage=_6a.style.backgroundImage;
  633. }
  634. if(_6b){
  635. for(var i=0;i<_6b.Count();i++){
  636. var _6c=_6b.GetElementAt(i).QueryInterface(Components.interfaces.nsIDOMCSSStyleRule);
  637. var _6d=_6c.style;
  638. for(var j=0;j<_6d.length;j++){
  639. var _6f=_6d[j];
  640. if(_6f=="background-image"&&_6d.getPropertyValue(_6f)!="none"){
  641. _6a.style.backgroundImage=_6d.getPropertyValue(_6f);
  642. }
  643. }
  644. }
  645. }
  646. }
  647. }
  648. },1);
  649. },hideImages:function(){
  650. var _70=cpvw_previewHandler.getPreviewFrame();
  651. var _71=_70.contentDocument.images;
  652. for(var i=0;i<_71.length;i++){
  653. _71[i].setAttribute("src",_71[i].src);
  654. }
  655. },pageLoad:function(evt){
  656. var _74=document.getElementById("cooliris-preview-overlay");
  657. if(_74.hidden){
  658. return;
  659. }
  660. var _75=cpvw_previewHandler.getPreviewFrame();
  661. _75.style.display="block";
  662. var _76=_75.contentDocument;
  663. if(_76.isPageLoad){
  664. return;
  665. }
  666. if(cpvw_previewHandler.isContextMenu){
  667. cpvw_objContextMenu.previewOnLoad(evt);
  668. }else{
  669. if(cpvw_docHandler){
  670. cpvw_docHandler.previewOnLoad(evt);
  671. _76.isPageLoad=true;
  672. }
  673. }
  674. if(cpvw_previewHandler.previewLaunchCount>=cpvw_adManager.adLaunchFrequency&&cpvw_adManager.getAdDisplayCount()<cpvw_adManager.adDisplayCap&&(cpvw_previewHandler.customSite!="google_images"&&cpvw_previewHandler.customSite!="yahoo_images"&&cpvw_previewHandler.customSite!="youtube_video")){
  675. cpvw_previewHandler.previewLaunchCount=0;
  676. cpvw_adManager.resetAdPrefs();
  677. _74.showAd();
  678. }
  679. },gotoNextLink:function(){
  680. var _77=cpvw_previewHandler.getPreviewFrame();
  681. if(_77.webNavigation.canGoForward){
  682. _77.webNavigation.goForward();
  683. cpvw_objStats.sendButtonClickEvents("forward");
  684. }
  685. cpvw_previewHandler.setNavigationArrows();
  686. },goBack:function(evt){
  687. var _79=cpvw_previewHandler.getPreviewFrame();
  688. if(_79.webNavigation.canGoBack){
  689. _79.webNavigation.goBack();
  690. cpvw_objStats.sendButtonClickEvents("Back");
  691. }
  692. cpvw_previewHandler.setNavigationArrows();
  693. },openLink:function(evt){
  694. try{
  695. var _7b=cpvw_objOverlay.getContentDocument();
  696. var url="",_7d;
  697. if(cpvw_previewHandler.isContextMenu){
  698. url=cpvw_objContextMenu.linkUrl;
  699. }else{
  700. if(cpvw_docHandler){
  701. _7d=cpvw_previewHandler.getPreviewFrame();
  702. var _7e=_7d.contentDocument;
  703. url=_7e.URL;
  704. if(url=="chrome://cooliris/content/coolirisPreviewImages.htm"){
  705. var doc=_7d.contentDocument;
  706. if(doc.getElementById("imgPreview").style.visibility=="visible"){
  707. url=doc.getElementById("imgPreview").getAttribute("src");
  708. }else{
  709. url=doc.getElementById("tmpImgPreview").getAttribute("src");
  710. }
  711. }
  712. var _80=_7d.webNavigation.sessionHistory;
  713. }
  714. }
  715. if(url==""){
  716. return;
  717. }
  718. cpvw_objStats.sendButtonClickEvents("OpenLink");
  719. if(_80){
  720. var _81=_80.SHistoryEnumerator;
  721. }
  722. getBrowser().selectedTab=getBrowser().addTab(url);
  723. if(_7d!=null&&_80!=null){
  724. while(_81.hasMoreElements()){
  725. var _82=_81.getNext().QueryInterface(Components.interfaces.nsIHistoryEntry);
  726. if(_81.hasMoreElements()){
  727. getBrowser().selectedBrowser.webNavigation.sessionHistory.QueryInterface(Components.interfaces.nsISHistoryInternal).addEntry(_82,true);
  728. }
  729. }
  730. }
  731. cpvw_previewHandler.hidePreview(true);
  732. evt.stopPropagation();
  733. }
  734. catch(e){
  735. throw e;
  736. }
  737. },resetZoom:function(){
  738. var _83=cpvw_previewHandler.getPreviewFrame();
  739. _83.markupDocumentViewer.fullZoom=1;
  740. },onZoomOpen:function(){
  741. clearTimeout(cpvw_previewHandler.zoomTimer);
  742. cpvw_previewHandler.dragActive=true;
  743. var _84=cpvw_prefHandler.getPrefJson(cpvw_Prefs.jsonPrefZoom);
  744. conDump("ZooomPref = "+_84.zoomType+",  "+_84.zoomSetting);
  745. cpvw_get("cooliris_zoom_Text").setAttribute("checked",(_84.zoomType=="text"));
  746. cpvw_get("cooliris_zoom_autoFit").setAttribute("checked",(_84.zoomSetting=="autofit"));
  747. },doZoom:function(how){
  748. cpvw_objStats.sendButtonClickEvents("Zoom");
  749. var _86=cpvw_prefHandler.getPrefJson(cpvw_Prefs.jsonPrefZoom);
  750. if(how=="textZoom"){
  751. if(_86.zoomType=="full"){
  752. _86.zoomType="text";
  753. }else{
  754. _86.zoomType="full";
  755. }
  756. }else{
  757. if(how=="reset"){
  758. var _87=cpvw_previewHandler.getPreviewFrame();
  759. if(_86.zoomType=="text"){
  760. _87.markupDocumentViewer.textZoom=1;
  761. _86.zoomTextSize=1;
  762. }else{
  763. _87.markupDocumentViewer.fullZoom=1;
  764. _86.zoomFullSize=1;
  765. }
  766. }else{
  767. if(how=="autofit"){
  768. if(_86.zoomSetting=="previews"){
  769. _86.zoomSetting="autofit";
  770. }else{
  771. _86.zoomSetting="previews";
  772. }
  773. }
  774. }
  775. }
  776. if(cpvw_docHandler&&(how=="increase"||how=="decrease")){
  777. var _87=cpvw_previewHandler.getPreviewFrame();
  778. try{
  779. var _88;
  780. if(_86.zoomType=="text"){
  781. _88=_87.markupDocumentViewer.textZoom;
  782. }else{
  783. _88=_87.markupDocumentViewer.fullZoom;
  784. }
  785. if(how=="increase"){
  786. _88+=0.1;
  787. }else{
  788. if(how=="decrease"){
  789. _88-=0.1;
  790. }
  791. }
  792. if(_88<0.2||_88>5){
  793. return;
  794. }
  795. if(_86.zoomType=="text"){
  796. _87.markupDocumentViewer.textZoom=_88;
  797. _86.zoomTextSize=_88;
  798. }else{
  799. _87.markupDocumentViewer.fullZoom=_88;
  800. _86.zoomFullSize=_88;
  801. }
  802. cpvw_docHandler.clearHideTimer();
  803. }
  804. catch(ex){
  805. alert(ex);
  806. }
  807. }
  808. conDump("zzooom "+_86.zoomType+" , "+_86.zoomSetting);
  809. cpvw_prefHandler.setPrefJson(cpvw_Prefs.jsonPrefZoom,_86);
  810. },addToStack:function(how){
  811. try{
  812. cpvw_objStats.sendButtonClickEvents("Stack");
  813. this.stackCount++;
  814. if(how=="link"){
  815. var url;
  816. var _8b=new cpvw_nsNodeType();
  817. _8b.getNodeType();
  818. if(_8b.onImage){
  819. url=_8b.linkURL;
  820. if(url==""){
  821. url=_8b.imageURL;
  822. }
  823. }else{
  824. if(_8b.onLink){
  825. url=_8b.linkURL;
  826. }else{
  827. url=document.popupNode.ownerDocument.location.href;
  828. }
  829. }
  830. if(url!=""){
  831. cpvw_stackManager.addToStack(null,url);
  832. }
  833. }else{
  834. var _8c;
  835. if(cpvw_docHandler){
  836. var _8d=cpvw_previewHandler.getPreviewFrame();
  837. var _8e=_8d.contentDocument;
  838. var url=_8e.URL;
  839. if(url.indexOf("chrome://cooliris/content/coolirisPreviewImages.htm")!=-1){
  840. var doc=_8d.contentDocument;
  841. url=doc.getElementById("imgPreview").getAttribute("src");
  842. }
  843. var _90=_8e.title;
  844. _8c=_8d.contentWindow;
  845. if(!cpvw_previewHandler.isLoaded){
  846. cpvw_stackManager.addToStack(null,url);
  847. }else{
  848. cpvw_stackManager.addToStack(_8c,url);
  849. }
  850. }
  851. }
  852. }
  853. catch(e){
  854. alert(e);
  855. }
  856. },highlight:function(how){
  857. if(cpvw_previewHandler.isContextMenu){
  858. if(!cpvw_objContextMenu.doneHighlight){
  859. cpvw_objContextMenu.highlightText("show");
  860. }else{
  861. cpvw_objContextMenu.highlightText("hide");
  862. }
  863. }else{
  864. if(cpvw_docHandler){
  865. if(!cpvw_docHandler.doneHighlight){
  866. cpvw_docHandler.highlightText("show",cpvw_previewHandler.isContextMenu);
  867. }else{
  868. cpvw_docHandler.highlightText("hide",cpvw_previewHandler.isContextMenu);
  869. }
  870. }
  871. }
  872. },openCoolirisWebsite:function(evt){
  873. cpvw_previewHandler.hidePreview(true);
  874. getBrowser().selectedTab=getBrowser().addTab("http://www.coolpreviews.com/client/links/support.html");
  875. evt.preventDefault();
  876. evt.stopPropagation();
  877. },toggleLocation:function(){
  878. var _93=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewFixedLoc);
  879. if(_93=="yes"){
  880. cpvw_prefHandler.setPref(cpvw_Prefs.prefPreviewFixedLoc,"no");
  881. }else{
  882. cpvw_prefHandler.setPref(cpvw_Prefs.prefPreviewFixedLoc,"yes");
  883. cpvw_Prefs.setPreviewLoc(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top);
  884. }
  885. },togglePushPin:function(){
  886. if(cpvw_previewHandler.pushpin){
  887. cpvw_previewHandler.pushpin=false;
  888. }else{
  889. cpvw_previewHandler.pushpin=true;
  890. }
  891. cpvw_prefHandler.setPref(cpvw_Prefs.prefLock,cpvw_previewHandler.pushpin);
  892. cpvw_previewHandler.updatePushpinIcon();
  893. cpvw_objStats.sendButtonClickEvents("Lock");
  894. },updateLocationIcon:function(){
  895. var _94=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewFixedLoc);
  896. if(_94=="yes"){
  897. document.getElementById("cooliris_fixedLoc").setAttribute("src","chrome://cooliris/skin/new/lock.gif");
  898. }else{
  899. document.getElementById("cooliris_fixedLoc").setAttribute("src","chrome://cooliris/skin/new/unlock.gif");
  900. }
  901. },updatePushpinIcon:function(){
  902. cpvw_previewHandler.getPreviewWindow().pushPin=cpvw_previewHandler.pushpin;
  903. },stickPreview:function(how){
  904. cpvw_previewHandler.sticky=how;
  905. },startFrameDrag:function(evt){
  906. if(cpvw_previewHandler.dragActive){
  907. return;
  908. }
  909. cpvw_previewHandler.curMouseLocX=evt.screenX;
  910. cpvw_previewHandler.curMouseLocY=evt.screenY;
  911. document.getElementById("cooliris-toolbar").style.cursor="-moz-grabbing";
  912. document.getElementById("cooliris_statusbar").style.cursor="-moz-grabbing";
  913. window.addEventListener("mouseup",cpvw_previewHandler.stopFrameDrag,true);
  914. window.addEventListener("mousemove",cpvw_previewHandler.moveFrame,true);
  915. cpvw_previewHandler.dragActive=true;
  916. },stopFrameDrag:function(evt){
  917. if(!cpvw_previewHandler.dragActive){
  918. return;
  919. }
  920. window.removeEventListener("mouseup",cpvw_previewHandler.stopFrameDrag,true);
  921. window.removeEventListener("mousemove",cpvw_previewHandler.moveFrame,true);
  922. cpvw_previewHandler.changeDimensions(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top,cpvw_previewHandler.dimPreview.width,cpvw_previewHandler.dimPreview.height,true);
  923. document.getElementById("cooliris-toolbar").style.cursor="";
  924. document.getElementById("cooliris_statusbar").style.cursor="";
  925. cpvw_Prefs.setPreviewLoc(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top);
  926. cpvw_previewHandler.dragActive=false;
  927. },moveFrame:function(evt){
  928. if(!cpvw_previewHandler.dragActive){
  929. return;
  930. }
  931. cpvw_previewHandler.dimPreview.left+=evt.screenX-cpvw_previewHandler.curMouseLocX;
  932. cpvw_previewHandler.dimPreview.top+=evt.screenY-cpvw_previewHandler.curMouseLocY;
  933. cpvw_previewHandler.curMouseLocX=evt.screenX;
  934. cpvw_previewHandler.curMouseLocY=evt.screenY;
  935. cpvw_previewHandler.changeDimensions(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top,cpvw_previewHandler.dimPreview.width,cpvw_previewHandler.dimPreview.height,true);
  936. },startResize:function(evt){
  937. if(cpvw_previewHandler.resizeActive){
  938. return;
  939. }
  940. cpvw_previewHandler.curMouseLocX=evt.screenX;
  941. cpvw_previewHandler.curMouseLocY=evt.screenY;
  942. document.getElementById("main-window").addEventListener("mouseup",cpvw_previewHandler.stopResize,true);
  943. document.getElementById("main-window").addEventListener("mousemove",cpvw_previewHandler.doResize,true);
  944. cpvw_previewHandler.resizeActive=true;
  945. },stopResize:function(evt){
  946. if(!cpvw_previewHandler.resizeActive){
  947. return;
  948. }
  949. cpvw_previewHandler.dimPreview.width+=evt.screenX-cpvw_previewHandler.curMouseLocX;
  950. cpvw_previewHandler.dimPreview.height+=evt.screenY-cpvw_previewHandler.curMouseLocY;
  951. if(cpvw_previewHandler.dimPreview.width<500){
  952. cpvw_previewHandler.dimPreview.width=500;
  953. }else{
  954. if(cpvw_previewHandler.dimPreview.width>window.outerWidth-40){
  955. cpvw_previewHandler.dimPreview.width=window.outerWidth-40;
  956. }
  957. }
  958. if(cpvw_previewHandler.dimPreview.height<100){
  959. cpvw_previewHandler.dimPreview.height=100;
  960. }else{
  961. if(cpvw_previewHandler.dimPreview.height>window.outerHeight-20){
  962. cpvw_previewHandler.dimPreview.height=window.outerHeight-20;
  963. }
  964. }
  965. document.getElementById("main-window").removeEventListener("mouseup",cpvw_previewHandler.stopResize,true);
  966. document.getElementById("main-window").removeEventListener("mousemove",cpvw_previewHandler.doResize,true);
  967. cpvw_previewHandler.changeDimensions(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top,cpvw_previewHandler.dimPreview.width,cpvw_previewHandler.dimPreview.height,true);
  968. cpvw_previewHandler.saveTipSize();
  969. cpvw_previewHandler.resizeActive=false;
  970. },removeDragResizeEventHandlers:function(){
  971. document.getElementById("main-window").removeEventListener("mouseup",cpvw_previewHandler.stopResize,true);
  972. document.getElementById("main-window").removeEventListener("mousemove",cpvw_previewHandler.doResize,true);
  973. document.getElementById("main-window").removeEventListener("mouseup",cpvw_previewHandler.stopResizeLeft,true);
  974. document.getElementById("main-window").removeEventListener("mousemove",cpvw_previewHandler.doResizeLeft,true);
  975. window.removeEventListener("mouseup",cpvw_previewHandler.stopFrameDrag,true);
  976. window.removeEventListener("mousemove",cpvw_previewHandler.moveFrame,true);
  977. },doResize:function(evt){
  978. if(!cpvw_previewHandler.resizeActive){
  979. return;
  980. }
  981. var _9c=cpvw_previewHandler.dimPreview.width+evt.screenX-cpvw_previewHandler.curMouseLocX;
  982. var _9d=cpvw_previewHandler.dimPreview.height+evt.screenY-cpvw_previewHandler.curMouseLocY;
  983. if(_9c<500||_9c>window.outerWidth-20||_9d<100||_9d>window.outerHeight-10){
  984. return;
  985. }
  986. cpvw_previewHandler.changeDimensions(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top,_9c,_9d,true);
  987. cpvw_subSearchBar.showSearchBar();
  988. },startResizeLeft:function(evt){
  989. if(cpvw_previewHandler.resizeActive){
  990. return;
  991. }
  992. cpvw_previewHandler.curMouseLocX=evt.screenX;
  993. cpvw_previewHandler.curMouseLocY=evt.screenY;
  994. document.getElementById("main-window").addEventListener("mouseup",cpvw_previewHandler.stopResizeLeft,true);
  995. document.getElementById("main-window").addEventListener("mousemove",cpvw_previewHandler.doResizeLeft,true);
  996. cpvw_previewHandler.resizeActive=true;
  997. },stopResizeLeft:function(evt){
  998. if(!cpvw_previewHandler.resizeActive){
  999. return;
  1000. }
  1001. cpvw_previewHandler.dimPreview.width=cpvw_previewHandler.dimPreview.width-(evt.screenX-cpvw_previewHandler.curMouseLocX);
  1002. cpvw_previewHandler.dimPreview.height+=evt.screenY-cpvw_previewHandler.curMouseLocY;
  1003. cpvw_previewHandler.dimPreview.left+=(evt.screenX-cpvw_previewHandler.curMouseLocX);
  1004. if(cpvw_previewHandler.dimPreview.width<500){
  1005. cpvw_previewHandler.dimPreview.width=500;
  1006. }else{
  1007. if(cpvw_previewHandler.dimPreview.width>window.outerWidth-40){
  1008. cpvw_previewHandler.dimPreview.width=window.outerWidth-40;
  1009. }
  1010. }
  1011. if(cpvw_previewHandler.dimPreview.height<100){
  1012. cpvw_previewHandler.dimPreview.height=100;
  1013. }else{
  1014. if(cpvw_previewHandler.dimPreview.height>window.outerHeight-20){
  1015. cpvw_previewHandler.dimPreview.height=window.outerHeight-20;
  1016. }
  1017. }
  1018. document.getElementById("main-window").removeEventListener("mouseup",cpvw_previewHandler.stopResizeLeft,true);
  1019. document.getElementById("main-window").removeEventListener("mousemove",cpvw_previewHandler.doResizeLeft,true);
  1020. cpvw_previewHandler.changeDimensions(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top,cpvw_previewHandler.dimPreview.width,cpvw_previewHandler.dimPreview.height,true);
  1021. cpvw_previewHandler.saveTipSize();
  1022. cpvw_Prefs.setPreviewLoc(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top);
  1023. cpvw_previewHandler.resizeActive=false;
  1024. },doResizeLeft:function(evt){
  1025. if(!cpvw_previewHandler.resizeActive){
  1026. return;
  1027. }
  1028. var _a1=cpvw_previewHandler.dimPreview.height+evt.screenY-cpvw_previewHandler.curMouseLocY;
  1029. var _a2=cpvw_previewHandler.dimPreview.left+(evt.screenX-cpvw_previewHandler.curMouseLocX);
  1030. var _a3=cpvw_previewHandler.dimPreview.width-(_a2-cpvw_previewHandler.dimPreview.left);
  1031. if(_a3<500||_a3>window.outerWidth-20||_a1<100||_a1>window.outerHeight-10){
  1032. return;
  1033. }
  1034. cpvw_previewHandler.changeDimensions(_a2,cpvw_previewHandler.dimPreview.top,_a3,_a1,true);
  1035. },saveTipSize:function(){
  1036. if(cpvw_previewHandler.customSite!="youtube_video"){
  1037. cpvw_Prefs.setPreviewSize(cpvw_previewHandler.dimPreview.width,cpvw_previewHandler.dimPreview.height);
  1038. }
  1039. },changeDimensions:function(_a4,top,_a6,_a7,_a8){
  1040. var _a9=getBrowser().selectedTab.getAttribute("coolirispreviews_dispStack");
  1041. if(top<0){
  1042. top=2;
  1043. }
  1044. if(_a4<10){
  1045. _a4=10;
  1046. }
  1047. if(top>(cpvw_get("appcontent").boxObject.y+cpvw_get("appcontent").boxObject.height)-60){
  1048. top=(cpvw_get("appcontent").boxObject.y+cpvw_get("appcontent").boxObject.height)-60;
  1049. }
  1050. if(top+_a7>cpvw_get("appcontent").boxObject.y+cpvw_get("appcontent").boxObject.height){
  1051. _a7=(cpvw_get("appcontent").boxObject.y+cpvw_get("appcontent").boxObject.height)-top-5;
  1052. }
  1053. if(_a4+_a6>cpvw_get("appcontent").boxObject.x+cpvw_get("appcontent").boxObject.width){
  1054. _a6=(cpvw_get("appcontent").boxObject.x+cpvw_get("appcontent").boxObject.width)-_a4-15;
  1055. }
  1056. if(_a4>cpvw_get("appcontent").boxObject.x+cpvw_get("appcontent").boxObject.width-100){
  1057. _a4=cpvw_get("appcontent").boxObject.x+cpvw_get("appcontent").boxObject.width-100;
  1058. }
  1059. if(_a9=="show"){
  1060. var _aa=cpvw_get("appcontent").boxObject.x+cpvw_get("appcontent").boxObject.width-118-30;
  1061. if(_a4+_a6>_aa){
  1062. _a6=_aa-_a4-10;
  1063. }
  1064. }
  1065. if(_a6<0){
  1066. _a6=2;
  1067. }
  1068. if(_a6<480){
  1069. _a6=480;
  1070. }
  1071. cpvw_get("cooliris-preview-overlay").showPopup(_a4,top,_a6,_a7);
  1072. if(CoolirisFramePanel.isSendToOpen&&CoolirisFramePanel.fromPreview){
  1073. var _ab=_a4+90;
  1074. var _ac=top+31;
  1075. if(cpvw_get("cooliris_sendToBox")){
  1076. var _ad=cpvw_get("cooliris_sendToBox").style.width;
  1077. var _ae=cpvw_get("cooliris_sendToBox").style.height;
  1078. cpvw_jsUtils.setPosition(cpvw_get("cooliris_sendToBox"),_ab,_ac,_ad,_ae,true);
  1079. }
  1080. }
  1081. if(CoolirisFramePanel.isHelperFrameOpen){
  1082. cpvw_get("cooliris_helperBox").hidden=false;
  1083. var _af=_a4+_a6-386;
  1084. cpvw_jsUtils.setPosition(cpvw_get("cooliris_helperBox"),_af,(top+31),385,219,true);
  1085. }
  1086. return;
  1087. },addBookmark:function(){
  1088. if(typeof addBookmarkAs=="function"){
  1089. addBookmarkAs(cpvw_previewHandler.getPreviewFrame(),false);
  1090. }
  1091. },openPiclensLite:function(){
  1092. var _b0="http://www.coolpreviews.com/client/links/cooliris_lite.php";
  1093. var _b1="http://www.coolpreviews.com/client/links/cooliris_lite_tab.php";
  1094. if(cpvw_previewHandler.customSite=="google_images"){
  1095. if(!cpvw_jsUtils.hasCooliris()){
  1096. cpvw_imageDocHandler.customSite=cpvw_previewHandler.customSite;
  1097. var obj=cpvw_jsUtils.decodeJson(cpvw_prefHandler.getPref(cpvw_Prefs.jsonPrefCooliris));
  1098. conDump("piclens lite ++ "+obj.showCoolirisPage+". "+cpvw_docHandler);
  1099. if(obj.showCoolirisPage){
  1100. cpvw_docHandler.popTimer=10;
  1101. cpvw_docHandler.showPreview(_b0);
  1102. cpvw_objStats.sendButtonClickEvents("CoolirisWebsite");
  1103. }else{
  1104. cpvw_imageDocHandler.startPiclensLite();
  1105. cpvw_previewHandler.hidePreview(true,"CoolirisLite");
  1106. }
  1107. }else{
  1108. if(cpvw_docHandler){
  1109. var _b3=cpvw_imageDocHandler.actualImgUrl;
  1110. cpvw_imageDocHandler.closeDelayTime=1000;
  1111. cpvw_previewHandler.dimPreview.width=950;
  1112. cpvw_previewHandler.dimPreview.height=675;
  1113. cpvw_previewHandler.pushpin=true;
  1114. cpvw_previewHandler.updatePushpinIcon();
  1115. cpvw_previewHandler.changeDimensions(cpvw_previewHandler.dimPreview.left,cpvw_previewHandler.dimPreview.top,cpvw_previewHandler.dimPreview.width,cpvw_previewHandler.dimPreview.height,true);
  1116. cpvw_docHandler.popTimer=setTimeout(function(){
  1117. var doc=cpvw_docHandler.parentDoc;
  1118. var _b5="jsfeed:"+doc.documentURI;
  1119. _b5="http://www.cooliris.com/tab/#url="+encodeURIComponent(_b5)+"&guid="+encodeURIComponent(_b3);
  1120. cpvw_docHandler.showPreview(_b5);
  1121. cpvw_imageDocHandler.coolirisOpen=true;
  1122. cpvw_objStats.sendButtonClickEvents("Cooliris");
  1123. },1);
  1124. }
  1125. }
  1126. }else{
  1127. cpvw_docHandler.popTimer=10;
  1128. cpvw_docHandler.showPreview(_b1);
  1129. cpvw_objStats.sendButtonClickEvents("CoolirisWebsite");
  1130. }
  1131. }};
  1132. var cpvw_previewUrlListener={QueryInterface:function(_b6){
  1133. if(_b6.equals(Components.interfaces.nsIWebProgressListener)||_b6.equals(Components.interfaces.nsISupportsWeakReference)||_b6.equals(Components.interfaces.nsISupports)){
  1134. return this;
  1135. }
  1136. throw Components.results.NS_NOINTERFACE;
  1137. },onLocationChange:function(_b7,_b8,_b9){
  1138. if(_b7.DOMWindow.parent==_b7.DOMWindow){
  1139. cpvw_previewHandler.numPages++;
  1140. cpvw_previewHandler.getPreviewWindow().setStatsUrl(cpvw_previewHandler.statsLink);
  1141. }
  1142. },onStateChange:function(){
  1143. },onProgressChange:function(){
  1144. },onStatusChange:function(){
  1145. },onSecurityChange:function(){
  1146. },onLinkIconAvailable:function(){
  1147. }};
  1148. var cpvw_urlListener={QueryInterface:function(_ba){
  1149. if(_ba.equals(Components.interfaces.nsIWebProgressListener)||_ba.equals(Components.interfaces.nsISupportsWeakReference)||_ba.equals(Components.interfaces.nsISupports)){
  1150. return this;
  1151. }
  1152. throw Components.results.NS_NOINTERFACE;
  1153. },onLocationChange:function(_bb,_bc,_bd){
  1154. if(_bb.DOMWindow.parent==_bb.DOMWindow){
  1155. var _be=cpvw_objOverlay.getContentDocument();
  1156. if(_be.fromCache!=null){
  1157. if(_be.enablePreview){
  1158. cpvw_docHandler.parentDoc=_be;
  1159. document.getElementById("preview-status-image").src="chrome://cooliris/skin/new/previews-on.png";
  1160. cpvw_get("preview-status").setAttribute("status","previewsOnSite");
  1161. }
  1162. }
  1163. var _bf=cpvw_siteManager.isCustomSite(_be.location.href);
  1164. if(_bf[0]){
  1165. cpvw_previewHandler.customSite=_bf[1];
  1166. }
  1167. }
  1168. },onStateChange:function(){
  1169. },onProgressChange:function(){
  1170. },onStatusChange:function(){
  1171. },onSecurityChange:function(){
  1172. },onLinkIconAvailable:function(){
  1173. }};
  1174. function cpvw_previewSize(_c0,top,_c2,_c3){
  1175. this.left=_c0;
  1176. this.top=top;
  1177. this.width=_c2;
  1178. this.height=_c3;
  1179. this.conDump=function(){
  1180. };
  1181. }
  1182. function cpvw_getDocuments(_c4){
  1183. var _c5=[];
  1184. if(_c4){
  1185. if(_c4.document){
  1186. _c5.push(_c4.document);
  1187. var _c6=_c4.document.getElementsByTagName("iframe");
  1188. if(_c6!=null&&_c6.length>0){
  1189. for(var i=0;i<_c6.length;i++){
  1190. _c5=_c5.concat(cpvw_getDocuments(_c6[i]));
  1191. }
  1192. }
  1193. }
  1194. if(_c4.frames!=null){
  1195. for(var i=0;i<_c4.frames.length;i++){
  1196. _c5=_c5.concat(cpvw_getDocuments(_c4.frames[i]));
  1197. }
  1198. }
  1199. }
  1200. return _c5;
  1201. }
  1202. window.addEventListener("load",cpvw_objOverlay.addEventHandlers,false);
  1203. window.addEventListener("unload",cpvw_objOverlay.removeEventHandlers,false);
  1204. window.addEventListener("resize",function(evt){
  1205. if(evt.target==window){
  1206. if(!(evt.target instanceof HTMLDocument)){
  1207. cpvw_stackManager.displayStack();
  1208. }
  1209. }
  1210. },false);
  1211. var cpvw_JSON={toString:function JSON_toString(_c9,_ca){
  1212. var _cb=[];
  1213. function append_piece(_cc){
  1214. if(typeof _cc=="string"){
  1215. _cc=_cc.replace(/[\\"\x00-\x1F\u0080-\uFFFF]/g,function($0){
  1216. switch($0){
  1217. case "\b":
  1218. return "\\b";
  1219. case "\t":
  1220. return "\\t";
  1221. case "\n":
  1222. return "\\n";
  1223. case "\f":
  1224. return "\\f";
  1225. case "\r":
  1226. return "\\r";
  1227. case "\"":
  1228. return "\\\"";
  1229. case "\\":
  1230. return "\\\\";
  1231. }
  1232. return "\\u"+("0000"+$0.charCodeAt(0).toString(16)).slice(-4);
  1233. });
  1234. _cb.push("\""+_cc+"\"");
  1235. }else{
  1236. if(typeof _cc=="boolean"){
  1237. _cb.push(_cc?"true":"false");
  1238. }else{
  1239. if(typeof _cc=="number"&&isFinite(_cc)){
  1240. _cb.push(_cc.toString());
  1241. }else{
  1242. if(_cc===null){
  1243. _cb.push("null");
  1244. }else{
  1245. if(_cc instanceof Array||typeof _cc=="object"&&"length" in _cc&&(_cc.length===0||_cc[_cc.length-1]!==undefined)){
  1246. _cb.push("[");
  1247. for(var i=0;i<_cc.length;i++){
  1248. arguments.callee(_cc[i]);
  1249. _cb.push(",");
  1250. }
  1251. if(_cc.length>0){
  1252. _cb.pop();
  1253. }
  1254. _cb.push("]");
  1255. }else{
  1256. if(typeof _cc=="object"){
  1257. _cb.push("{");
  1258. for(var key in _cc){
  1259. if(_ca&&_ca.indexOf(key)!=-1){
  1260. continue;
  1261. }
  1262. arguments.callee(key.toString());
  1263. _cb.push(":");
  1264. arguments.callee(_cc[key]);
  1265. _cb.push(",");
  1266. }
  1267. if(_cb[_cb.length-1]==","){
  1268. _cb.pop();
  1269. }
  1270. _cb.push("}");
  1271. }else{
  1272. throw new TypeError("No JSON representation for this object!");
  1273. }
  1274. }
  1275. }
  1276. }
  1277. }
  1278. }
  1279. }
  1280. append_piece(_c9);
  1281. return _cb.join("");
  1282. },fromString:function JSON_fromString(_d0){
  1283. if(!this.isMostlyHarmless(_d0)){
  1284. throw new SyntaxError("No valid JSON string!");
  1285. }
  1286. var s=new Components.utils.Sandbox("about:blank");
  1287. return Components.utils.evalInSandbox("("+_d0+")",s);
  1288. },isMostlyHarmless:function JSON_isMostlyHarmless(_d2){
  1289. var _d3=/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/;
  1290. var _d4=/"(\\.|[^"\\\n\r])*"/g;
  1291. return !_d3.test(_d2.replace(_d4,""));
  1292. }};
  1293. var cpvw_adManager={leftAdFrameSize:0,topAdFrameSize:0,rightAdFrameSize:0,bottomAdFrameSize:0,adLaunchFrequency:0,adDisplayCap:3,adDisplayCapCookie:"displayCount",adPrefsUrl:"http://previews.cooliris.com/ads/adPrefs.php",adServer:"http://previews.cooliris.com/ads/adServer.php",domain:"http://previews.cooliris.com/",getAdDisplayCount:function(){
  1294. var ios=Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
  1295. var uri=ios.newURI(this.domain,null,null);
  1296. var _d7=Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
  1297. var _d8=_d7.getCookieString(uri,null);
  1298. var _d9=this.readCookie(this.adDisplayCapCookie,_d8)||0;
  1299. if(_d9==""){
  1300. _d9=0;
  1301. }
  1302. return _d9;
  1303. },readCookie:function(_da,_db){
  1304. var _dc=_da+"=";
  1305. try{
  1306. var ca=_db.split(";");
  1307. for(var i=0;i<ca.length;i++){
  1308. var c=ca[i];
  1309. while(c.charAt(0)==" "){
  1310. c=c.substring(1,c.length);
  1311. }
  1312. if(c.indexOf(_dc)==0){
  1313. return c.substring(_dc.length,c.length);
  1314. }
  1315. }
  1316. }
  1317. catch(ex){
  1318. return null;
  1319. }
  1320. return null;
  1321. },resetAdPrefs:function(){
  1322. var _e0=cpvw_previewHandler.getPreviewWindow();
  1323. _e0.leftAdFrameSize=cpvw_adManager.leftAdFrameSize;
  1324. _e0.rightAdFrameSize=cpvw_adManager.rightAdFrameSize;
  1325. _e0.topAdFrameSize=cpvw_adManager.topAdFrameSize;
  1326. _e0.bottomAdFrameSize=cpvw_adManager.bottomAdFrameSize;
  1327. },handleEvent:function(evt){
  1328. if(evt.type=="coolpreviewsCloseAdEvent"){
  1329. var _e2=cpvw_previewHandler.getPreviewWindow();
  1330. var id=evt.currentTarget.getAttribute("anonid");
  1331. switch(id){
  1332. case "cpvw_leftAdFrame":
  1333. _e2.leftAdFrameSize=0;
  1334. break;
  1335. case "cpvw_topAdFrame":
  1336. _e2.topAdFrameSize=0;
  1337. break;
  1338. case "cpvw_rightAdFrame":
  1339. _e2.rightAdFrameSize=0;
  1340. break;
  1341. case "cpvw_bottomAdFrame":
  1342. _e2.bottomAdFrameSize=0;
  1343. break;
  1344. }
  1345. _e2.showAd();
  1346. cpvw_objStats.sendButtonClickEvents("CloseAd");
  1347. }else{
  1348. if(evt.type=="coolpreviewsShowAdEvent"){
  1349. var _e2=cpvw_previewHandler.getPreviewWindow();
  1350. var _e4=evt.target.getAttribute("showAd");
  1351. if(_e4=="true"){
  1352. _e2.showAd("display");
  1353. }else{
  1354. _e2.leftAdFrameSize=0;
  1355. _e2.topAdFrameSize=0;
  1356. _e2.rightAdFrameSize=0;
  1357. _e2.bottomAdFrameSize=0;
  1358. _e2.showAd();
  1359. }
  1360. }
  1361. }
  1362. }};
  1363. var cpvw_uninstallManager={_uninstall:false,observe:function(_e5,_e6,_e7){
  1364. if(_e6=="em-action-requested"){
  1365. _e5.QueryInterface(Components.interfaces.nsIUpdateItem);
  1366. if(_e5.id=="{CE6E6E3B-84DD-4cac-9F63-8D2AE4F30A4B}"){
  1367. if(_e7=="item-uninstalled"){
  1368. this._uninstall=true;
  1369. var _e8=Components.classes["@cooliris.com/CoolPreviews;1"].getService().wrappedJSObject;
  1370. if(!_e8.uninstallPageDisplayed){
  1371. _e8.uninstallPageDisplayed=true;
  1372. var _e9=cpvw_objOverlay.uninstallPage+"?guid="+cpvw_prefHandler.getPref(cpvw_Prefs.prefGUID)+"&version="+cpvw_objStats.getAddonVersion(true)+"&adId="+cpvw_prefHandler.getPref(cpvw_Prefs.prefAdId);
  1373. openUILinkIn(_e9,"tab");
  1374. cpvw_objStats.sendInstallEvent("uninstall");
  1375. }
  1376. }else{
  1377. if(_e7=="item-cancel-action"){
  1378. this._uninstall=false;
  1379. }
  1380. }
  1381. }
  1382. }else{
  1383. if(_e6=="quit-application-granted"){
  1384. if(this._uninstall){
  1385. }
  1386. this.unregister();
  1387. }
  1388. }
  1389. },register:function(){
  1390. var _ea=Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
  1391. _ea.addObserver(this,"em-action-requested",false);
  1392. _ea.addObserver(this,"quit-application-granted",false);
  1393. },unregister:function(){
  1394. var _eb=Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
  1395. _eb.removeObserver(this,"em-action-requested");
  1396. _eb.removeObserver(this,"quit-application-granted");
  1397. }};
  1398.  
  1399.